package h.ku.utils
{
	import flash.events.TimerEvent;
	import flash.utils.Timer;

	public class Scheduler
	{
		public static var runSinceUpdate:uint = 0
		public static var runPerUpdate:uint = 100
		public static function exec(f:Function,t:uint):void
		{
			runSinceUpdate ++
			if(runSinceUpdate > runPerUpdate)
			{
			var time:Timer = new Timer(t,1)
			time.addEventListener(TimerEvent.TIMER,
				function(e:TimerEvent):void
				{
					runSinceUpdate = 0
					f.call()
				})
			time.start()
			}else{
				f.call()
			}
		}
	}
}